package homework.day2;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("dome.txt");
        Scanner in = new Scanner(System.in);
        String stop = "exit";
        while(true){
            System.out.println("请输入要写的字符串（exit为退出）");
            String line= in.next();
            if (stop.equals(line)){
                break;
            }else {
                byte[] date = line.getBytes(StandardCharsets.UTF_8);
                fos.write(date);
            }
        }
        fos.close();
    }
}
